import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/purchaseItem/listDto',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/purchaseItem/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/purchaseItem/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/purchaseItem/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/purchaseItem/submit',
    method: 'post',
    data: row
  })
}

export const exportBusinessMonth =(params,month) =>  {
  return request({
    url:'/api/purchaseItem/exportBusinessMonth',
    method:'post',
    responseType:'blob',
    params:params,month,
    timeout: 30000,
  })
}

export const getListDto = (current, size, params) => {
  return request({
    url: '/api/purchaseItem/purchaseItemStatisticsDto',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const exportBusinessStatistics =(params,month) =>  {
  return request({
    url:'/api/purchaseItem/exportPurchaseStatistics',
    method:'post',
    responseType:'blob',
    params:params,month,
    timeout: 30000,
  })
}


export const getRegionSummaryStatisticsDto = (current, size, params) => {
  return request({
    url: '/api/purchaseItem/regionSummaryStatisticsDto',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const exportStatistics =(params,month) =>  {
  return request({
    url:'/api/purchaseItem/exportPurchaseStatistics',
    method:'post',
    responseType:'blob',
    params:params,month,
    timeout: 30000,
  })
}
